/*
 * Copyright (c) gitee.com/jiandong001.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


//
//package com.facebook.yoga;
//TODO: enum IS Better?
export const enum YogaEdge {
  LEFT = 0,
  TOP = 1,
  RIGHT = 2,
  BOTTOM = 3,
  START = 4,
  END = 5,
  HORIZONTAL = 6,
  VERTICAL = 7,
  ALL = 8,
}

export function getYogaEdgeFromNumber(value: number): YogaEdge {
  switch (value) {
    case 0: return YogaEdge.LEFT;
    case 1: return YogaEdge.TOP;
    case 2: return YogaEdge.RIGHT;
    case 3: return YogaEdge.BOTTOM;
    case 4: return YogaEdge.START;
    case 5: return YogaEdge.END;
    case 6: return YogaEdge.HORIZONTAL;
    case 7: return YogaEdge.VERTICAL;
    case 8: return YogaEdge.ALL;
    default: throw new Error("Unknown enum value: " + value);
  }
}


//export class YogaEdge {
//
//  static readonly LEFT = 0;
//  static readonly TOP = 1
//  static readonly RIGHT = 2
//  static readonly BOTTOM = 3
//  static readonly START = 4
//  static readonly END = 5
//  static readonly HORIZONTAL = 6
//  static readonly VERTICAL = 7
//  static readonly ALL = 8
//
//  private readonly mIntValue: number;
//
//  constructor(intValue: number) {
//    this.mIntValue = intValue;
//  }
//
//  public intValue(): number {
//    return this.mIntValue;
//  }
//
//  public static fromInt(value: number): number {
//    switch (value) {
//      case 0: return YogaEdge.LEFT;
//      case 1: return YogaEdge.TOP;
//      case 2: return YogaEdge.RIGHT;
//      case 3: return YogaEdge.BOTTOM;
//      case 4: return YogaEdge.START;
//      case 5: return YogaEdge.END;
//      case 6: return YogaEdge.HORIZONTAL;
//      case 7: return YogaEdge.VERTICAL;
//      case 8: return YogaEdge.ALL;
//      default: throw new Error("Unknown enum value: " + value);
//    }
//  }
//}
